/**
 * Created by Administrator on 2019/6/17.
 */
var nav = document.querySelectorAll(".nav li");
var main = document.querySelectorAll(".main > div");
console.log(nav);
console.log(main);

for(var i = 0; i<nav.length; i++){
    nav[i].index = i;
    nav[i].addEventListener('mouseenter',function () {
        for (var j = 0; j<nav.length; j++){
            nav[j].classList.remove('xian');
            main[j].classList.remove('guo');
        }
        this.classList.add('xian');
        main[this.index].classList.add('guo');
    })
}